package com.sbtr.business.system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.sbtr.business.system.entity.ItemInfo;
import com.sbtr.business.system.dto.ItemInfoDto;

import com.sbtr.business.system.service.ItemInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sbtr.business.system.mapper.ItemInfoMapper;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sbtr.common.PageDto;
import com.sbtr.util.PageDtoUtils;
import org.springframework.transaction.annotation.Transactional;

/**
 * 项目基本信息（用于模型、特征工程、算法等模块总入口，其次用于数据汇总） Service接口实现类
 *
 * @author maojianping
 * @since  2023-04-11
 */
@Transactional
@Service
public class ItemInfoServiceImpl extends ServiceImpl<ItemInfoMapper,ItemInfo> implements ItemInfoService {

    @Autowired
    ItemInfoMapper itemInfoMapper;

    @Override
    public PageDto<ItemInfo> pageList(ItemInfoDto itemInfoDto) {

        IPage<ItemInfo> page = new Page<>();
        page.setSize(itemInfoDto.getPageSize());
        page.setCurrent(itemInfoDto.getPage());
        page = itemInfoMapper.selectPages(page, BeanUtil.beanToMap(itemInfoDto));
        PageDto<ItemInfo> r = PageDtoUtils.getPageDtoByIPage(page, ItemInfo.class);

        return r;
    }
}

